#!/usr/bin/python2.5
import download
import db
import time
import sys
import traceback
import subscriptions
import listen
from log import log

def main():
  db.Init()

  subscriptions.Load()
  download.Start()
  subscriptions.ImportOPML("podcasts.opml")
  MainLoop()

def MainLoop():
  while True:
    time.sleep(1)

try:
  main()
except KeyboardInterrupt:
  print "^C"
  db.Shutdown()
  sys.exit(1)
except:
  print "Exception in main thread"
  traceback.print_exc()
  sys.exit(1)

